package com.zz.framework.core.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import com.chad.library.adapter4.BaseQuickAdapter

/**
 * Copyright © 2024 zhun All rights reserved.
 * Created by Zha0Zhun on 2024/6/5 10:24.
 * @author: Zha0Zhun 1820022519@qq.com
 * @version: V1.0
 */
 abstract class BaseKotlinAdapter<T: Any> protected constructor(private val mLayoutId:Int) : BaseQuickAdapter<T, BaseViewHolder>() {
    override fun onBindViewHolder(holder: BaseViewHolder, position: Int, item: T?) {
        convert(holder,position,item)
    }
    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): BaseViewHolder {
        return BaseViewHolder(LayoutInflater.from(parent.context).inflate(mLayoutId, parent, false))
    }
    abstract fun convert(holder: BaseViewHolder, position: Int, item: T?)
}